<include file="Public/min-header"/>
<div class="wrapper">
    <include file="Public/breadcrumb"/>

    <!-- Main content -->
    <section class="content">
        <div class="container-fluid">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 实名认证列表</h3>
                </div>
                <div class="navbar navbar-default">
                    <div class="collapse navbar-collapse">
                        <form class="navbar-form form-inline" action="{:U('Certification/lists')}" method="post">
                            <div class="form-group">
                                <input type="text" name="username" class="form-control" placeholder="姓名" value='{$username}'>
                            </div>
                            <button type="submit" class="btn btn-primary" data-toggle='tooltip'data-original-title="查询">查询</button>
                            <a href="javascript:;" data-url="{:U('Certification/right_del')}" onclick="delAll(this,'right')" class="btn btn-primary">批量删除</a>
                        </form>
                    </div>
                </div>
                <div class="panel-body">
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover">
                            <thead>
                            <tr>
                                <td class="text-left"><input type="checkbox" onclick="choosebox(this)">全选</td>
                                <td class="text-center">ID</td>
                                <td class="text-center" style='width: 10%'>姓名</td>
                                <td class="text-center">身份证号码</td>
                                <td class="text-center">手持身份证正面照片</td>
                                <td class="text-center">身份证正面照片</td>
                                <td class="text-center">审核状态</td>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="lists" id="list">
                                <tr>
                                    <td><input type="checkbox" name="right[]" value="{$list.sm_id}"></td>
                                    <td class="text-center">{$list.sm_id}</td>
                                    <td class="text-center">{$list.username}</td>
                                    <td class="text-center">{$list.card}</td>
                                    <td class="text-center"><img width="100px" height="100px" src="{$list.zheng}" alt=""/></td>
                                    <td class="text-center"><img width="100px" height="100px" src="{$list.fan}" alt=""/></td>
                                    <td class="text-center">
                                        审核通过
                                    </td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                        <div class="pull-center">
                            {$page}
                        </div>
                    </div>
                </div>
            </div>
        </div>        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script>
    $(document).ready(function(){
        ajax_get_table('search-form2',1);

    });


    $(document).on('click','#tongguo',function(){
        var id=$(this).attr('val');
        update_shop_status(id,2);
    });

    $(document).on('click','#bohui',function(){
        var id=$(this).attr('val');
        update_shop_status(id,3);
    });
    //修改店铺状态
    function update_shop_status(id,status){
        $.ajax({
            url:"/index.php?m=Admin&c=Certification&a=update_certification_status",
            type:"post",
            data:{id:id,status:status},
            dataType:"json",
            success: function(msg) {
                if(msg.result ==400 || msg.result=='400'){
                    alert('审核失败');
                }else {
                    alert('审核成功');
                    window.location.href="";
                }
            }
        });
    }



    // ajax 抓取页面
    function ajax_get_table(tab,page){
        cur_page = page; //当前页面 保存为全局变量
        $.ajax({
            type : "POST",
            url:"/index.php/Admin/user/ajaxindex/p/"+page,//+tab,
            data : $('#'+tab).serialize(),// 你的formid
            success: function(data){
                $("#ajax_return").html('');
                $("#ajax_return").append(data);
            }
        });
    }

    // 点击排序
    function sort(field)
    {
        $("input[name='order_by']").val(field);
        var v = $("input[name='sort']").val() == 'desc' ? 'asc' : 'desc';
        $("input[name='sort']").val(v);
        ajax_get_table('search-form2',cur_page);
    }

    //批量删除
    function choosebox(o){
        var vt = $(o).is(':checked');
        if(vt){
            $('input[type=checkbox]').prop('checked',vt);
        }else{
            $('input[type=checkbox]').removeAttr('checked');
        }
    }


    $(document).on('click','#del',function(){
        var id=$(this).attr('val');
        if(confirm('确定要删除吗?')){
            $.ajax({
                url:"/index.php?m=Admin&c=Certification&a=Certification_del",
                type:"post",
                data:{id:id},
                dataType:"json",
                success: function(msg){
                    if(msg.result ==400 || msg.result=='400'){
                        alert('删除失败');
                    }else {
                        alert('删除成功');
                        window.location.href="";
                    }
                }
            });
        }

        return false;
    });
</script>
</body>
</html>